﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LogInfo.aspx.cs" Inherits="BEGDC.CC.Web.Admin.LogInfo" %>

<%@ Register Src="../UserControls/Pager.ascx" TagName="Pager" TagPrefix="cc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../css/global.css" rel="stylesheet" type="text/css" />
    <link href="../css/content/entity.css" rel="stylesheet" type="text/css" />
    <link href="../css/content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link href="../css/main.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../js/jquery-ui.min.js" type="text/javascript"></script>

    <script src="../js/entity.js.aspx" type="text/javascript"></script>

    <style type="text/css">
        .description_row
        {
            overflow: hidden;
            width: 450px;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    </style>

    <script type="text/javascript">
        $(function() {

            $(".datepicker").datepicker({
                changeYear: true,
                changeMonth: true,
                yearRange: 'c-40:c+10',
                changeYear: true,
                showOn: "button",
                buttonImage: "../../images/calendar.gif",
                buttonImageOnly: true,
                buttonText: 'Open Calendar (打开日历)'
            }).attr("readonly", "true");

            $(".date-cmp").bind("change", function() {

                var targetclass;
                var targetflag;
                var classes = $(this).attr('class').split(' ');
                for (i = 0; i < classes.length; i++) {
                    if (classes[i].indexOf('date-min') == 0) {
                        targetclass = 'date-max' + classes[i].substring(8, classes[i].length);
                        targetflag = 'max';
                        break;
                    }
                    else if (classes[i].indexOf('date-max') == 0) {
                        targetclass = 'date-min' + classes[i].substring(8, classes[i].length);
                        targetflag = 'min';
                        break;
                    }
                }

                if (targetclass != null) {
                    var target = $(".date-cmp." + targetclass).first();
                    var targetvalue = target.val();
                    if (targetvalue != '') {
                        if (targetflag == 'max') {
                            if (targetvalue.valueOf() < $(this).val().valueOf()) {
                                var mintitle = $(this).parent().prev().text();
                                var maxtitle = target.parent().prev().text();
                                alert('[' + mintitle + ']' + ' could not be later than ' + '[' + maxtitle + ']');
                                $(this).val('');
                            }
                        }
                        else //for targetflag == 'min'
                        {
                            if (targetvalue.valueOf() > $(this).val().valueOf()) {
                                var maxtitle = $(this).parent().prev().text();
                                var mintitle = target.parent().prev().text();
                                alert('[' + maxtitle + ']' + ' could not be earlier than ' + '[' + mintitle + ']');
                                $(this).val('');
                            }
                        }
                    }
                }
            });

        });
    </script>

</head>
<body>
    <form runat="server">
    <div class="mainbox">
        <div class="sitemapbox">
            <div id="info" class="sitemap">
                &nbsp;»&nbsp;Administration&nbsp;»&nbsp;Operation Log
            </div>
        </div>
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <!--tab区域-->
                    <div class="tabbox purplebg_dark">
                        <ul class="tabpos">
                            <li><span class="tab_active">
                                <%=Resources.PageTitles.OperationLog%></span></li>
                        </ul>
                    </div>
                    <div class="formbox">
                        <asp:Panel ID="gridPanel" runat="server" CssClass="formbox_float_lft">
                            <div>
                                <span class=" float_lft">StartTime (开始时间):</span><span class=" float_lft padding_lft20">
                                    <input name="Log_StartTime" readonly="true" class="txtbox datepicker date-cmp date-min1"
                                        value="<%#Eval("StartTime", "{0:d}") %>" /></span></div>
                            <div>
                                <span class="float_lft padding_lft20">EndTime (结束时间):</span><span class=" float_lft padding_lft20">
                                    <input name="Log_EndTIme" readonly="true" class="txtbox datepicker date-cmp date-max1"
                                        value="<%#Eval("EndTime", "{0:d}") %>" /></span></div>
                            <br />
                            <br />
                        </asp:Panel>
                        <span class=" float_lft">
                            <div class="formbox_float_lft">
                                <asp:Button ID="BtnAdd" runat="server" Style="display: none" CssClass="entity-add" />
                            </div>
                            <div class="formbox_float_rgt">
                                <asp:TextBox ID="txtSearch" runat="server" CssClass="txtbox width140 entity-search-text"
                                    ToolTip="Description,Module"></asp:TextBox>
                                <asp:Button ID="btnSearch" runat="server" CssClass="entity-search" />
                                <asp:Button ID="btnClear" runat="server" CssClass="entity-clear" />
                            </div>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
        <table width="100%" id="Table1" cellspacing="0" cellpadding="0" border="0">
            <tbody>
                <tr>
                    <td>
                        <asp:GridView ID="gvLog" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                            DataSourceID="edsLog" AllowPaging="True" EmptyDataText="There is no data to display!"
                            CssClass="tablestyle" AllowSorting="True">
                            <RowStyle CssClass="tbody" />
                            <HeaderStyle CssClass="thead" ForeColor="#ffffff" />
                            <Columns>
                                <asp:TemplateField HeaderText="Description<br/>操作描述" SortExpression="Description">
                                    <ItemTemplate>
                                        <div class="description_row">
                                            <%#HttpUtility.HtmlEncode((string)Eval("Description"))%></div>
                                    </ItemTemplate>
                                    <ItemStyle Width="49%" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="Module" HeaderText="Module<br/>模块名称" SortExpression="Module"
                                    HtmlEncode="false" ItemStyle-Width="6%" />
                                <asp:TemplateField HeaderText="CIL<br/>操作人" SortExpression="Employee.EmployeeNo">
                                    <ItemTemplate>
                                        <asp:Label ID="Employee" runat="server" Text='<%#Eval("Employee.NameCN")%>' />
                                    </ItemTemplate>
                                    <ItemStyle Width="10%" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Title<br/>职位" SortExpression="Employee.EmployeeNo">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%#Eval("Employee.Title")%>' />
                                    </ItemTemplate>
                                    <ItemStyle Width="20%" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="Time" HeaderText="Time<br/>操作时间" SortExpression="Time"
                                    HtmlEncode="false" ItemStyle-Width="12%" />
                                <asp:ActionField HeaderText="Action<br/>操作" ShowViewButton="true" />
                            </Columns>
                            <PagerTemplate>
                                <cc:Pager ID="Pager1" runat="server" />
                            </PagerTemplate>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DetailsView ID="dvLog" runat="server" AutoGenerateRows="False" DataKeyNames="ID"
                            DataSourceID="edsLog" Visible="False" CssClass="tablestyle2" Width="90%">
                            <HeaderStyle CssClass="tablestyle2_Title"></HeaderStyle>
                            <HeaderTemplate>
                                <%=Resources.PageTitles.OperationLog%>
                            </HeaderTemplate>
                            <FieldHeaderStyle CssClass="tablestyle2_tdTitle" />
                            <Fields>
                                <asp:TemplateField HeaderText="CIL (操作人)">
                                    <ItemTemplate>
                                        <asp:Label ID="Employee" runat="server" Text='<%#Eval("Employee.NameEN")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Title (职位)">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%#Eval("Employee.Title")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Module" HeaderText="Module (模块名称)" SortExpression="Module"
                                    HtmlEncode="false" />
                                <asp:BoundField DataField="Time" HeaderText="Time (操作时间)" HtmlEncode="false" SortExpression="Time" />
                                <asp:BoundField DataField="Description" HeaderText="Description (操作描述)" SortExpression="Description" />
                                <asp:ActionField ShowCloseButton="true" />
                            </Fields>
                        </asp:DetailsView>
                        &nbsp;
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <%--以下是数据源--%>
    <asp:EntityDataSource ID="edsLog" runat="server" ConnectionString="name=CCEntities"
        DefaultContainerName="CCEntities" EntitySetName="OperationLog" Include="Employee"
        OrderBy="it.ID DESC" Where="it.ID>1">
    </asp:EntityDataSource>
    </form>
    <%--页面刷新时显示--%>
    <div id="dialog-message" title="Loading..." style="display: none">
        <p>
            <br />
            <span class="entity-loading"></span><span>Operation in process, please wait...<br />
                <br />
                处理中, 请稍候。。。</span>
        </p>
    </div>
</body>
</html>
